package com.whucke.im.utils;

import io.netty.buffer.ByteBuf;

/**
 * 字符串处理工具
 *
 * @author Zhang Peng
 * @since 2019/2/21 17:25
 */
public abstract class StringUtil {

    /**
     * 字符串转换
     *
     * @param byteBuf
     * @return
     */
    public static String transformToString(ByteBuf byteBuf) {
        if (byteBuf == null) {
            return null;
        }
        byte[] data = new byte[byteBuf.capacity()];
        byteBuf.readBytes(data);
        return new String(data);
    }

}
